library(ggplot2)  
p <- ggplot(data=mpg,aes(x=displ,y=hwy,colour=factor(cyl)))  
p + geom_point() + geom_smooth()  
